<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 函数表达式
        let fn1 = async function () {
            return '函数表达式'
        }
        fn1().then(res=>{
            console.log('ok:' ,res);
        }, err => {
            console.log('no:', err);
        })

        // 对象的方法
        let obj1 = {
            name: 'Tom',
            age: 18,
            fn2: async function() {
                console.log('我是fn2');
                return '我是fn2'
            },
            async fn3() {
                console.log('我是fn3');
                return '我是fn3'
            }
        }
        obj1.fn2().then(res => {
            console.log('fn2:', res);
        })
        obj1.fn3().then(res => {
            console.log('fn3:', res);
        })
    </script>
</body>
</html>